import java.util.Arrays;
import java.util.Scanner;

import java.util.Arrays;
import java.util.Scanner;

public class hejunzhi {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("你要输入的元素个数");

        int n = sc.nextInt();
        int[] arr = new int[n];
        System.out.println("请输入"+n+"个元素");
        for (int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }
        System.out.println("sum="+myTest("sum",arr) );
        System.out.println("avg="+myTest("avg",arr) );
        System.out.println("max="+myTest("max",arr) );
    }
    public static double myTest (String type,int...a) {
        double result = 0.0;
        int sum = 0;
        double max=0;
        if (type == "sum") {
            for (int i = 0; i < a.length; i++) {
                sum += a[i];
                result = sum;
            }
        } else if (type == "avg") {
            for (int i = 0; i < a.length; i++) {
                sum += a[i];
            }
            result = (double) sum / a.length;
        } else if (type == "max") {
            for (int i = 0; i < a.length; i++) {
                 max = Math.max(result,a[i]);
                 result = max;
            }
        }
        return result;
    }
    
}